﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
    x:Class="ALiteTeam.PackageTracer.View.Selector"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    DataContext="{Binding SelectorViewModel, Source={StaticResource ViewModelLocator }}"
    shell:SystemTray.IsVisible="True">
    
    <Grid x:Name="LayoutRoot">
        <!--设定配置好的背景图-->
        <Grid.Background>
            <ImageBrush ImageSource="{Binding BackgroundImage, Source={StaticResource ViewModelLocator}}"/>
        </Grid.Background>
        <controls:Pivot x:Name="pivot" Title="风讯快递查询">
            <controls:PivotItem Header="选择快递">
                <toolkit:LongListSelector x:Name="longList" Width="470" Height="620" ItemsSource="{Binding DeliveryGroups}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <GalaSoft_MvvmLight_Command:EventToCommand
                                Command="{Binding NavigationToInputCommand}"
                                CommandParameter="{Binding ElementName=longList}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <toolkit:LongListSelector.GroupHeaderTemplate>
                        <DataTemplate>
                            <Border Background="Transparent" Margin="12,8,0,8">
                                <Border Background="{StaticResource PhoneAccentBrush}" 	
                                        Width="72" Height="72"
                                        HorizontalAlignment="Left">
                                    <TextBlock Text="{Binding Key}" Margin="0, 0, 0, 4"
                                               Foreground="{StaticResource PhoneForegroundBrush}" 
                                               Style="{StaticResource PhoneTextExtraLargeStyle}"
                                               FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                               HorizontalAlignment="Center"
                                               VerticalAlignment="Bottom"/>
                                </Border>
                            </Border>
                        </DataTemplate>
                    </toolkit:LongListSelector.GroupHeaderTemplate>
                    <toolkit:LongListSelector.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding DisplayName}"
                                       Foreground="{StaticResource PhoneForegroundBrush}" 
                                       Style="{StaticResource PhoneTextLargeStyle}"
                                       FontFamily="{StaticResource PhoneFontFamilyNormal}" 
                                       Margin="12,-8,12,6"/>
                        </DataTemplate>
                    </toolkit:LongListSelector.ItemTemplate>
                    <toolkit:LongListSelector.GroupItemTemplate>
                        <DataTemplate>
                            <Border Background="{StaticResource PhoneAccentBrush}" 
                                    Width="90" Height="90" Margin="6">
                                <TextBlock Text="{Binding Key}"
                                           Margin="0, 0, 0, 6"
                                           FontSize="64"
                                           FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                           Style="{StaticResource PhoneTextExtraLargeStyle}"
                                           Foreground="{StaticResource PhoneForegroundBrush}"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Bottom"/>
                            </Border>
                        </DataTemplate>
                    </toolkit:LongListSelector.GroupItemTemplate>
                    <toolkit:LongListSelector.GroupItemsPanel>
                        <ItemsPanelTemplate>
                            <toolkit:WrapPanel/>
                        </ItemsPanelTemplate>
                    </toolkit:LongListSelector.GroupItemsPanel>
                </toolkit:LongListSelector>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
</phone:PhoneApplicationPage>
